Skip to content

feat(terminal): add per-provider custom CLI arguments#2692

Open
Chizukuo wants to merge 13 commits into
farion1231:mainfrom
Chizukuo:feat/custom-cli-args
Open

feat(terminal): add per-provider custom CLI arguments#2692
Chizukuo wants to merge 13 commits into
farion1231:mainfrom
Chizukuo:feat/custom-cli-args

Conversation

@Chizukuo

Copy link
Copy Markdown

Allow users to configure additional CLI arguments (e.g. --dangerously-skip-permissions) per provider via ProviderMeta.customCliArgs. When opening a terminal for a provider, the args are appended to the launch command. The setting is available in the provider edit form under "Advanced Config".

Summary / 概述

This PR adds support for per-provider custom CLI arguments (e.g. --dangerously-skip-permissions). This is implemented by adding a new customCliArgs field to ProviderMeta which allows users to configure additional parameters in the "Advanced Config" section of the provider edit form. When a terminal is launched for a specific provider, these custom arguments are automatically appended to the underlying launch command (such as claude --settings <path> [custom_args]).

本 PR 添加了针对不同供应商配置自定义 CLI 启动参数的支持(例如 --dangerously-skip-permissions)。在编辑供应商表单的“高级配置”中新增了对应输入框,并将其存入 ProviderMeta.customCliArgs。当为特定供应商启动终端时,这些自定义参数将自动附加在最终的启动命令末尾。

Related Issue / 关联 Issue

Fixes # [填写相关的Issue编号,若无则保留空]

Screenshots / 截图

Before / 修改前 After / 修改后
image image
Advanced Config 无自定义 CLI 参数输入框 Advanced Config 显示新的自定义 CLI 参数输入框并有对应提示信息

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • cargo clippy passes (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)
  • Updated i18n files if user-facing text changed / 如修改了用户可见文本,已更新国际化文件

Chizukuo added 2 commits May 10, 2026 19:37
@
feat(terminal): add custom CLI arguments setting for terminal launcher

Allow users to configure additional CLI arguments (e.g. --dangerously-skip-permissions)
that are appended to the command when opening a provider terminal. The setting is
available in Settings > General > Terminal Settings and applies to all platforms.
@
Allow users to configure additional CLI arguments (e.g. --dangerously-skip-permissions)
per provider via ProviderMeta.customCliArgs. When opening a terminal for a provider,
the args are appended to the launch command. The setting is available in the provider
edit form under "Advanced Config".
@Chizukuo Chizukuo marked this pull request as ready for review May 10, 2026 12:34
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ea093cd76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/commands/misc.rs Outdated
@farion1231

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@farion1231

Copy link
Copy Markdown
Owner

@codex review
@claude review

@claude

claude Bot commented May 12, 2026

Copy link
Copy Markdown

Claude finished @farion1231's task in 2m 25s —— View job


Review

LGTM — no blocking issues.

Walked through the diff in detail. Summary of what I checked:

  • Codex's P1 (shell injection via customCliArgs) is addressed by commit 3bf2e7a. User input is now parsed through shlex::split (rejecting unclosed quotes with a log::warn!), then:
    • On macOS/Linux, re-quoted with shlex::try_join before interpolation into the bash script — so shell metacharacters in the original input survive as literal argv elements.
    • On Windows, each parsed token goes through a new escape_windows_batch_arg (src-tauri/src/commands/misc.rs:1394) that doubles %, doubles internal ", doubles trailing backslashes, and wraps in "...". Reasonable approach for batch-file argument escaping.
  • Schema / persistence: ProviderMeta.custom_cli_args (Rust) ↔ customCliArgs (TS) ↔ JSON field customCliArgs are consistent. skip_serializing_if = "Option::is_none" plus customCliArgs.trim() || undefined in ProviderForm.tsx:1229 correctly avoids persisting empty strings. No migration concerns (purely additive optional field).
  • Form wiring: state init, effect reset on initialData change, and prop plumbing to ProviderAdvancedConfig all look correct.
  • i18n: en, ja, zh all add the three matching keys.
  • Tests: tests/utils/providerMetaUtils.test.ts adds a merge-preservation case for the new field.

Minor observation (non-blocking, intentional given the commit message):

  • shlex::split follows POSIX rules, so a Windows user typing e.g. --workdir C:\Users\foo would have backslashes stripped (becomes C:Usersfoo). Workaround is forward slashes or single-quoting. Worth keeping in mind if user reports come in; the placeholder/hint don't currently call this out.
    • Branch: feat/custom-cli-args

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bf2e7a251

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/commands/misc.rs
@Chizukuo Chizukuo force-pushed the feat/custom-cli-args branch from 28392f7 to 7b62d7f Compare June 12, 2026 03:40
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants